﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SageKing.Extensions;

public static class RedisOptionsExts
{
    public static string CheckConfiguration(this RedisOptions redisOptions)
    {
        var config = redisOptions.Configuration;

        if(!config.Contains("server=", StringComparison.InvariantCultureIgnoreCase))
        {
            config = $"server={config}";
        }
        if (!config.Contains("db=", StringComparison.InvariantCultureIgnoreCase))
        {
            config = $"{config};db=0;";
        }   
        return config;
    }
}
